import csv
import requests
from bs4 import BeautifulSoup
url = 'http://www.vegnet.com.cn/Price/List.html'
data = requests.get(url)
data.encoding="utf-8"

soup = BeautifulSoup(data.text, 'html.parser')
data.close()

#prettify()用于格式化输出htm
#print(soup.prettify())

f= open("test.csv", mode="w",encoding="utf-8")
Writer = csv.writer(f)

data = soup.find("div", class_="main gap")

table =data.find("p", class_="skin_gre").text

Writer.writerow([table])

content =data.find("div", class_="pri_k").text.strip()

Writer.writerow([content])












